﻿using System;
using System.Linq.Mapping;
using System.Configuration;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Linq;
using System.IO;
using System.Web;

namespace NewsInfo
{
    public sealed partial class News
  {
      private static string conn = ConfigurationManager.ConnectionStrings["KKcms_SqlConnection"].ConnectionString;
      private static XmlMappingSource xms = XmlMappingSource.FromXml(File.ReadAllText(HttpContext.Current.Server.MapPath("~/App_Code/NewsInfo.map")));
      private static News instance = null;
      private static readonly object padlock = new object();
      public static News Instance
      {
          get
          {
              if (instance == null)
              {
                  lock (padlock)
                  {
                      if (instance == null)
                      {
                          instance = new News(conn, xms);
                      }
                  }
              }
              return instance;
          }
      }
  }
}
